# -*- coding:utf-8 -*-

from libs.handler import BaseHandler
from tornado.escape import json_encode,json_decode

from libs.pic import Pic
import os

class TaobaoComplete(BaseHandler):
    def get(self, num_iid):
		from libs.taobao import Taobao
		item = self.db.get("SELECT pic_url FROM items WHERE num_iid=%s", num_iid)
		pic = Pic(item["pic_url"]).getContent()
		from libs.isno import Baidu
		isno = Baidu()
		
		ret = isno.create_object("/isno/a2.jpg", pic)
		self.write(str(ret))
		return
     

handlers = []
handlers = [
    (r"/tools/taobao/complete/(\d+)",TaobaoComplete)
]
